package org.onepiece.admin.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * Created by IntelliJ IDEA.
 *
 * @author zhujianke@gaodun.com
 * @since 2022/9/4 18:31
 */
@Component
public class SysUserAddConsumer {

    @KafkaListener(topics = {"onepiece-user-add-topic"}, groupId = "onepiecegroup")
    public void listener(ConsumerRecord<String, String> record) {
        //获取消息
        String message = record.value();
        //消息偏移量
        long offset = record.offset();
        System.out.println("读取的消息：" + message + "\n当前偏移量：" + offset);
    }

}
